# Contributor: Sascha Brawer <sascha@brawer.ch>
# Maintainer: Sascha Brawer <sascha@brawer.ch>
pkgname=protozero
pkgver=1.7.1
pkgrel=4
pkgdesc="Minimalist protocol buffer decoder and encoder in C++"
url="https://github.com/mapbox/protozero"
arch="noarch"
license="BSD-2-Clause AND Apache-2.0"
makedepends="cmake protobuf-dev samurai"
subpackages="$pkgname-dev $pkgname-doc"
source="protozero-$pkgver.tar.gz::https://github.com/mapbox/protozero/archive/refs/tags/v$pkgver.tar.gz"

build() {
	LDFLAGS="$LDFLAGS -Wl,--copy-dt-needed-entries" \
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_CXX_STANDARD=17 \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_TESTING="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	ctest --output-on-failure --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -Dm644 LICENSE.* -t "$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="
90bf1f487efa0ad9da2f3b887b7a6dbd849fa3687dd2126c324f902a8584722f4f7d4a2ea86f6a0e75999f7be829f6ae26cad9df1cae55d0b29a9ec24a4dbfd2  protozero-1.7.1.tar.gz
"
